package com.hand.qiandu.config;

import com.hand.qiandu.interceptor.ControllerInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 24748  刘瑞锋
 * @date 2019/7/17
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private ControllerInterceptor controllerInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截user下的
        System.out.println("webConfig");
        registry.addInterceptor(controllerInterceptor).addPathPatterns("/**");
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

    }
}
